﻿using UnityEngine;
using UnityEditor;

public class FollowSceneCamera : MonoBehaviour
{
    public Vector3 offset = Vector3.zero;
    public bool enableFollow = true;
    public bool onlySelectFollow = true;

    private void OnDrawGizmos()
    {
        if (!enableFollow) return;
        if (onlySelectFollow)
        {
            if (Selection.activeGameObject == null 
                || !Selection.activeGameObject.transform.Equals(transform)) return;
        }

        transform.position = Camera.current.transform.position + offset;
        transform.rotation = Camera.current.transform.rotation;
    }
}
